package com.example.tanhuanapp.controller;

import com.aliyun.oss.OSSClient;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @author IT空门_门主
 * @date 2024/1/11
 */
@Configuration
@PropertySource("classpath:application.properties")
@Data
public class AliyunOssConfig {
    @Value("${aliyun.oss.endpoint}")
    private String endpoint;
    @Value("${aliyun.sms.accessKeyId}")
    private String accessKeyId;
    @Value("${aliyun.sms.accessKeySecret}")
    private String accessKeySecret;
    @Value("${aliyun.oss.bcketName}")
    private String bucketName;
    @Value("${aliyun.oss.urlprefix}")
    private String urlPrefix;

    /**
     * 将OSS注入容器
     * @return
     */
    @Bean
    public OSSClient ossClient(){
        return new OSSClient(endpoint,accessKeyId,accessKeySecret);
    }



}
